import json
import requests

def func(data):
     return data["data"]["idTwoZ"]




if __name__ == '__main__':
    jsonStr = "{\"name\":\"曾智\",\"id\":\"500235199212260331\"}"
    varStd=json.loads(jsonStr)
    result={"apiName":"身份证二要素验证","secret":"abfa041cc7a84419957ca69421bb0680","shortName":"br"}
    result["name"]=varStd["name"]
    result["id"]=varStd["id"]
    str = json.dumps(result)
    host = 'http://zebra.sit.com/service-interface-gateway/api/invoke'
    requests.DEFAULT_RETRIES = 10# 增加重试连接次数
    s = requests.session()
    s.keep_alive = False
    header_dict = {"Content-Type": "application/json; charset=utf8",
                   "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
                  }
    r = s.post(host, data=str, headers=header_dict)
    r.close()
    json_data = ''
    if (r.ok):
        json_data = r.json()
    print(func(json_data))